<cfinclude template="/ecada/header.cfm">

<cfoutput>
	#id#
	<cfquery datasource="exp" name="numtrials">
			SELECT t.id, filepath, c.description as conddescription, StimuliTypeID, s.answer, st.type 
			FROM trial t, stimuli s, conditions c, filestore fs, stimulitype st
			WHERE t.expid=#id#
			AND t.stimid = s.id 
			AND condid = c.id
			AND s.fileID = fs.id
			AND s.stimuliTypeId = st.id
			ORDER BY condid 
	</cfquery>

	<h1>Select buttons to see results for individual trials</h1>

	<cfloop query = numtrials>
		<table border = 1>
			<tr>	
				<cfif #IsNumeric(answer)#>
					<cfif type eq 'picture'>
						<td>
							<a href="/ecada/analyse/answersgiven.cfm?trialid=#numtrials.id#">
								<img src="/ecada/#numtrials.filepath#" width=100>
							</a>
						</td>
						<td>
							<font color="red">Image:</font>
							#GetFileFromPath(numtrials.filepath)#
							<br>
							<font color="red">Condition:</font>
							#numtrials.conddescription#

							<!---this takes us to answers given charts --->
							<form method="post" action="/ecada/analyse/answersgiven.cfm">
								<input type = "hidden" name= "trialid" value = "#numtrials.id#">
								<input type = "submit" value="Charts to Analyse Answers">
							</form>

							<!---this takes us to trial timing charts --->
							<form method="post" action="/ecada/analyse/linetimingbytrial.cfm">
								<input type = "hidden" name= "trialid" value = "#numtrials.id#">
								<input type = "submit" value="Charts to Analyse Timing">
							</form>
						</td>
					<cfelseif type eq 'audio'>
						audio
					<cfelseif type eq 'video'>
						video
					<cfelseif type eq 'text'>
						text
					<cfelse>
						<td>
							<a href="/ecada/analyse/answersgiven.cfm?trialid=#numtrials.id#">
								<img src="/ecada/images/placeholder.png">
							</a>
						</td>
						<td>
							<font color="red">File:</font>
							#GetFileFromPath(numtrials.filepath)#<br>
							<font color="red">Condition:</font>
							#numtrials.conddescription#
						</td>
					</cfif>
				<cfelse>
					Answer not numeric
				</cfif>
			</tr>
		</table>
	</cfloop>
</cfoutput>

<cfinclude template="/ecada/footer.cfm">
